package com.shanzhe.eshop.common.jdk;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author yinwei
 * @create 2021/12/13
 * @Version 1.0
 */
public class ConcurrentHashMapDemo {

    public static void main(String[] args) {
        final ConcurrentHashMap<String, String> concurrentHashMap = new ConcurrentHashMap<String, String>();

        new Thread(){
            @Override
            public void run() {
                concurrentHashMap.put("k1","v1");
            }
        }.start();

        new Thread(){
            @Override
            public void run() {
                concurrentHashMap.put("k2","v2");
                concurrentHashMap.get("k1");
            }
        }.start();
    }
}
